﻿package com.msjt.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.msjt.dao.QuestionDAO;
import com.msjt.entity.Question;
import com.msjt.service.IQuestionService;
/**
 * name:QuestionServices
 * function:咨询模块的业务逻辑实现类
 * author: kw
 * time:2013.8.27
 * updateTime:2013.9.2
 */
public class QuestionService implements IQuestionService {
	//数据model
	@Resource
	private QuestionDAO questionDao;

	public QuestionDAO getQuestionDao() {
		return questionDao;
	}

	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IQuestionService#setQuestionDao(com.msjt.dao.QuestionDAO)
	 */
	public void setQuestionDao(QuestionDAO questionDao) {
		this.questionDao = questionDao;
	}
	
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IQuestionService#getQuestionIndex()
	 */
	public List<Question> getQuestionIndex(){
		return this.questionDao.getIndexQuestion();
	}
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IQuestionService#getQuestionPageAfter(int, int)
	 */
	public List<Question> getQuestionPageAfter(int pageIndex,int pageSize){
		return this.questionDao.getQuestionByPageAfter(pageIndex, pageSize);
	}
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IQuestionService#getQuestionSeeMore(int, int)
	 */
	public List<Question> getQuestionSeeMore(int pageIndex,int pageSize){
		return this.questionDao.getQuestionByPage(pageIndex, pageSize);
	}
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IQuestionService#addQuestion(com.msjt.entity.Question)
	 */
	public boolean addQuestion(Question question){
		return this.questionDao.addQuestion(question);
	}
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IQuestionService#answerQuestion(com.msjt.entity.Question)
	 */
	public boolean answerQuestion(Question question){
		return this.questionDao.addAnswer(question);
	}
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IQuestionService#deleteQuestion(com.msjt.entity.Question)
	 */
	public boolean deleteQuestion(Question question){
		return this.questionDao.deleteQuestion(question);
	}
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IQuestionService#updateState(com.msjt.entity.Question)
	 */
	public boolean updateState(Question question){
		return this.questionDao.updateState(question);
	}

	public Integer getQuestionCount(Question question) {
		return this.questionDao.getQuestionCount(question);
	}

	public Question getOneQuestion(Question question) {
		return this.questionDao.getOneQuestion(question);
	}

	public boolean updateAnswer(Question question) {
		return this.questionDao.updateAnswer(question);
	}

	public List<Question> selectByLike(Question question,int pageIndex,int pageSize) {
		return this.questionDao.selectByLike(question, pageIndex, pageSize);
	}

	public boolean deleteMore(String idString) {
		// TODO Auto-generated method stub
		return this.questionDao.deleteMore(idString);
	}
}
